

import sys
import time
import random

def 快排(arr):
    if arr == []:
        return []
    else:
        头 = arr[0]
        尾 = arr[1:]
        更小 = list(filter(lambda x: x < 头, 尾))
        相等 = list(filter(lambda x: x == 头, 尾))
        更大 = list(filter(lambda x: x > 头, 尾))
        return 快排(更小) + [头] + 相等 + 快排(更大)

if __name__ == "__main__":
    if len(sys.argv) != 2:
        print("Usage: python quicksort.py <length>")
        sys.exit(1)
    
    n = int(sys.argv[1])
    array = [random.random() for _ in range(n)]
    #print(array)
    start_time = time.time()
    sorted_array = 快排(array)
    #print(sorted_array)
    end_time = time.time()
    
    time_diff = end_time - start_time
    print(f"{time_diff:.6f}")